const joi = require('joi');

const id = joi.number().required();

const password = joi.string().pattern(/^(\w){6,20}$/).required();

const phone = joi.string().required();
const nick_name = joi.string().required();
const name = joi.string().required();
const sex = joi.number().required();
const id_number = joi.string();
const user_photo = joi.string();
const birth_date = joi.date();
const address = joi.string();
const bank = joi.string();
const bank_number = joi.string();
const trial_contract = joi.string();

const id_position = joi.number().required();
const id_department1 = joi.number().required();
const id_department2 = joi.number().required();
const entry_date = joi.date().required();
const try_out_money = joi.number().required();
const id_authority = joi.number().required();
// 员工状态
const state = joi.number().required();
// 转正日期，转正工资
const regularization_date = joi.date().required();
const official_salary = joi.number().required();
const regularization_pdf = joi.string();
// 离职日期，离职原因
const leave_date = joi.date().required();
const leave_reason = joi.string().required();
const leave_pdf = joi.string();

const ids = joi.string().required();
const s_user_id = joi.number().required();

// 修改密码
exports.updatePassword_schema = {
	body: {
		id,
		password
	}
}

// 新增员工
exports.addUser_schema = {
	body: {
		phone,
		nick_name,
		name,
		sex,
		user_photo,
		birth_date,
		address,
		bank,
		bank_number,
		id_number,
		id_position,
		id_department1,
		id_department2,
		entry_date,
		try_out_money,
		id_authority,
		trial_contract
	}
};

// 更新员工
exports.updateUser_schema = {
	body: {
		id,
		phone,
		nick_name,
		name,
		sex,
		user_photo,
		birth_date,
		address,
		bank,
		bank_number,
		id_number,
		id_position,
		id_department1,
		id_department2,
		entry_date,
		try_out_money,
		id_authority,
		trial_contract
	}
};

// 通过id查询员工所有信息
exports.getUser_schema = {
	body: {
		id
	}
}

// 转正
exports.regularization_schema = {
	body: {
		id,
		regularization_date,
		official_salary,
		state,
		regularization_pdf
	}
}

// 离职
exports.leave_schema = {
	body: {
		id,
		leave_date,
		leave_reason,
		state,
		leave_pdf
	}
}

// 查看个人历史工资记录
exports.getUserSalary_schema = {
	body: {
		s_user_id
	}
}